﻿using RAP.Framework.Libary.DataSource.Model;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Text;

namespace RAP.Framework.Libary.DataSource.DataReader
{
  /// <summary>
  /// 自定义IDataReader数据解析器
  /// </summary>
  public interface IDataReaderParser
  {
    /// <summary>
    /// 
    /// </summary>
    /// <param name="dataReader"></param>
    /// <param name="pickFields"></param>
    /// <param name="type"></param>
    /// <param name="parseContext">解析时用到的上下文对象</param>
    /// <returns></returns>
    ParseResult ParseData(IDataReader dataReader, IList pickFields, string type, DataParseContext parseContext);

    /// <summary>
    /// 将数据库的值转换成C#类型
    /// </summary>
    /// <param name="dataReader"></param>
    /// <param name="field"></param>
    /// <returns></returns>
    object GetDBValue(IDataReader dataReader, DBField field);

    /// <summary>
    /// 
    /// </summary>
    /// <param name="resultTypeName"></param>
    /// <param name="properites"></param>
    /// <returns></returns>
    object CreateDataModel(string resultTypeName = null, IDictionary properites = null);
  }
}
